#SingleInstance, Force
SendMode Input
SetWorkingDir, %A_ScriptDir%
; tool for system



Sys_IME(state:=0) {
    ; switch ime state: 0-EN, 1-ZH

    If(GetKeyState("CapsLock", "T")) {  ; turn off uppercase
        SetCapsLockState , Off
    }

    WinGet, hWnd, ID, A
    DefaultIMEWnd := DllCall("imm32\ImmGetDefaultIMEWnd", Uint, hWnd, Uint)
    DetectSave := A_DetectHiddenWindows

    DetectHiddenWindows , ON
    SendMessage 0x283, 0x006, state, , ahk_id %DefaultIMEWnd%
    DetectHiddenWindows , %DetectSave%

    ; Return ErrorLevel
}



Sys_Sound(sound := -1) {
    ; get sound or set sound by n [0, 100]
    If(sound==-1) {
        SoundGet, sound
        Return sound
    }
    SoundSet, %sound%
}

Sys_SoundHalf() {
    Sys_Sound(Sys_Sound() / 2)
}



Sys_AHKVersion() {  ; get ahk version
    Return A_AhkVersion
}